export GLOG_logtostderr=1
export GLOG_v=2
jit_model_path=/home/work_nfs15/asr_data/ckpt/asr_online_system/jit_script_chunk_32_left_1024.pt
#jit_model_path=/home/work_nfs15/asr_data/ckpt/asr_online_system/jit_script.pt
unit_path=/home/work_nfs15/asr_data/ckpt/asr_online_system/lang_char_bpe/tokens.txt
scp_path=wav_1000.scp
scp_path=wav_10.scp
text_path=/home/work_nfs15/asr_data/data/aishell_1/raw_scp/test/text

fst_dir=/home/node54_tmpdata/xlgeng/code/gxl_ai_utils/eggs/cats_and_dogs/ngram_task/train_ngram/gxl_arpa_zoo/asr_poi_xian/lang_test
fst_path=$fst_dir/TLG.fst
beam=32
dict_path=$fst_dir/words.txt
lattice_beam=5
max_active=7000
min_active=200
acoustic_scale=1.2
blank_skip_thresh=0.98
length_penalty=0.0

wfst_decode_opts=
if [ ! -z $fst_path ]; then
  wfst_decode_opts="--fst_path $fst_path"
  wfst_decode_opts="$wfst_decode_opts --beam $beam"
  wfst_decode_opts="$wfst_decode_opts --dict_path $dict_path"
  wfst_decode_opts="$wfst_decode_opts --lattice_beam $lattice_beam"
  wfst_decode_opts="$wfst_decode_opts --max_active $max_active"
  wfst_decode_opts="$wfst_decode_opts --min_active $min_active"
  wfst_decode_opts="$wfst_decode_opts --acoustic_scale $acoustic_scale"
  wfst_decode_opts="$wfst_decode_opts --blank_skip_thresh $blank_skip_thresh"
  wfst_decode_opts="$wfst_decode_opts --length_penalty $length_penalty"
#  echo $wfst_decode_opts > $dir/config
fi

../runtime/libtorch/build/bin/websocket_server_main \
    --port 10089 \
    --chunk_size 32 \
    --rescoring_weight 5.0 \
    --model_path $jit_model_path \
    $wfst_decode_opts \
    --unit_path $unit_path 2>&1 | tee server.log
